package com.ruoyi.system.api.factory;


import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemotePublicService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemotePublicFallbackFactory  implements FallbackFactory<RemotePublicService> {

    private static final Logger log = LoggerFactory.getLogger(RemotePublicFallbackFactory.class);

    @Override
    public RemotePublicService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemotePublicService() {
            @Override
            public R<String> qywxxcx_msg_push(JSONObject info, String source) {
                return R.fail("获取微信用户失败:" + throwable.getMessage());
            }
        };
    }
}
